#!/bin/bash

# 启动 CMDB Web 临时项目

echo "=========================================="
echo "   CMDB 黑名单忽略规则管理 Web 界面"
echo "=========================================="
echo ""

cd "$(dirname "$0")"

# 检查是否安装了依赖
if [ ! -d "node_modules" ]; then
    echo "📦 首次运行，正在安装依赖..."
    npm install
    echo ""
fi

echo "🚀 启动开发服务器..."
echo ""
echo "访问地址："
echo "  - 本地: http://localhost:5173"
echo "  - 网络: http://$(hostname -I | awk '{print $1}'):5173"
echo ""
echo "API 后端地址: http://localhost:8888"
echo ""
echo "按 Ctrl+C 停止服务器"
echo ""

npm run dev
